import { createRouter, createWebHistory } from 'vue-router'

// 路由懒加载
const Home = () => import('../views/home/index.vue')
const FundResearch = () => import('../views/fund-research/index.vue')
const FundTags = () => import('../views/fund-research/tags.vue')
const FactorManagement = () => import('../views/factor-management/index.vue')
const FactorCreate = () => import('../views/factor-management/create.vue')
const StrategyManagement = () => import('../views/strategy-management/index.vue')
const StrategyCreate = () => import('../views/strategy-management/create.vue')
const PortfolioManagement = () => import('../views/portfolio-management/index.vue')
const PortfolioCreate = () => import('../views/portfolio-management/create.vue')
const TradeManagement = () => import('../views/trade-management/index.vue')
const TradeCreate = () => import('../views/trade-management/create.vue')
const OnlineUsers = () => import('../views/online-users/index.vue')

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/register.vue')
  },
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/fund-research',
    name: 'FundResearch',
    component: FundResearch
  },
  {
    path: '/fund-research/tags',
    name: 'FundTags',
    component: FundTags
  },
  {
    path: '/factor-management',
    name: 'FactorManagement',
    component: FactorManagement
  },
  {
    path: '/factor-management/create',
    name: 'FactorCreate',
    component: FactorCreate
  },
  {
    path: '/strategy-management',
    name: 'StrategyManagement',
    component: StrategyManagement
  },
  {
    path: '/strategy-management/create',
    name: 'StrategyCreate',
    component: StrategyCreate
  },
  {
    path: '/portfolio-management',
    name: 'PortfolioManagement',
    component: PortfolioManagement
  },
  {
    path: '/portfolio-management/create',
    name: 'PortfolioCreate',
    component: PortfolioCreate
  },
  {
    path: '/trade-management',
    name: 'TradeManagement',
    component: TradeManagement
  },
  {
    path: '/trade-management/create',
    name: 'TradeCreate',
    component: TradeCreate
  },
  {
    path: '/online-users',
    name: 'OnlineUsers',
    component: () => import('../views/online-users/index.vue')
  },
  {
    path: '/user-profile',
    name: 'UserProfile',
    component: () => import('../views/online-users/user-profile.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router 